Implement event_description of EventFormattingAgent.

Akinori MUSHA 10 years ago
parent
commit
fd0d9ed930
1 changed files with 13 additions and 1 deletions
  1. 13 1
      app/models/agents/event_formatting_agent.rb

+ 13 - 1
app/models/agents/event_formatting_agent.rb

@@ -80,7 +80,19 @@ module Agents
80 80
           }
81 81
     MD
82 82
 
83
-    event_description "User defined"
83
+    event_description do
84
+      "Events will have the following fields%s:\n\n    %s" % [
85
+        case options['mode'].to_s
86
+        when 'merged'
87
+          ', merged with the original contents'
88
+        when /\{/
89
+          ', conditionally merged with the original contents'
90
+        end,
91
+        Utils.pretty_print(Hash[options['instructions'].keys.map { |key|
92
+          [key, "..."]
93
+        }])
94
+      ]
95
+    end
84 96
 
85 97
     after_save :clear_matchers
86 98